package com.ad.models;

import java.util.ArrayList;
import java.util.List;

import com.ad.system.Common;

public class Site implements IComposite {

	private List<Site> children;

	private Site parent;

	private String name;

	private String id;

	public void addChild(Site site) {
		if (Common.isEmpty(children)) {
			children = new ArrayList<Site>();
		}
		children.add(site);
	}

	public void removeChild(String id) {
		if (Common.isEmpty(children)) {
			return;
		}
		for (int i = 0; i < children.size(); i++) {
			Site site = children.get(i);
			if (id.equalsIgnoreCase(site.getId())) {
				children.remove(site);
				break;
			}
		}
	}

	public List<Site> getChildren() {
		return children;
	}

	public void setChildren(List<Site> children) {
		this.children = children;
	}

	public Site getParent() {
		return parent;
	}

	public void setParent(Site parent) {
		this.parent = parent;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

}
